#ifndef DOWNLOADLAYOUT_H
#define DOWNLOADLAYOUT_H

#include <QLayout>

class DownloadLayout
{
public:
    static DownloadLayout* getInstance();
    void setDownloadLayout(QWidget* p);
    QLayout* getDownloadLayout();

private:
    DownloadLayout() = default;
    ~DownloadLayout() = default;
    DownloadLayout(const DownloadLayout& obj) = delete;
    DownloadLayout& operator=(const DownloadLayout& obj) = delete;
    DownloadLayout(DownloadLayout&& obj) = delete;
    DownloadLayout& operator=(DownloadLayout&& obj) = delete;

    static DownloadLayout* instance;
    QLayout* m_layout;
    QWidget* m_wg;
private:
    class AutoRelease
    {
    public:
        AutoRelease() = default;
        ~AutoRelease()
        {
            if(instance == nullptr) return;
            delete instance;
            instance = nullptr;
        }
    };
private:
    static AutoRelease _at;
};

#endif // DOWNLOADLAYOUT_H
